This invention relates generally to object locking in a distributed printing system. More particularly, this invention is directed to the use of a locking time-out mechanism to avoid deadlock situations in a distributed printing system.
Distributed printing systems provide the means to control and access various printers and to manage other related information remotely. There are print servers that use a single document manager based on the protocol of DPA ISO 10175 which streamline document processing and allow for minimization of unit manufacturing costs. Examples of such servers may be found in products made available by Xerox Corporation under the xe2x80x9cDocument Centrexe2x80x9d product name.
The distributed printing system will preferably employ an implementation known as the ISO document processing architecture (DPA) standard as envisioned by ISO/IEC 10175. The DPA print system is based on a two level client-server model. Both print spooler and printer supervisor act as servers.
A print client accepts commands from the user, submits requests to the printing system, and receives and communicates responses from the printing system to the user. A print spooler is a server that accepts operations from print clients and schedules print jobs on its printer supervisors. A printer supervisor accepts requests from print spoolers to print jobs on its physical printers. The printer supervisor also accepts other requests from the print spooler and/or print client.
A DPA printing system prints jobs that can be made up of one or more documents. A job that resides in a printing system is realized as a job object that transitions through a set of job states. The documents that make up a job in a printing system are realized as a set of document objects which transition through a set of document states.
A process from anywhere in the system may send an action or operation to an object, requesting that the object perform a certain action upon itself. Depending upon the action requested in relation to the current state of the object, the object transitions itself to a predetermined state in which it performs a series of commands. Many requests transmitted to objects may cause the objects to initiate subsequent actions upon themselves and/or upon other secondary objects.
Objects in a system may be subject to locks, which restrict access to the object in order to preserve the integrity of the data or attributes associated with that object. Locking, or more generally the process of barring use of an object, is used in situations when more than one entity or user might try to access the same object at the same time.
In a multi-threaded environment, many users can read from or write to commonly accessed objects. Locking prevents simultaneous access to the same object.
It may be desirable to lock an object, perform the work required for the processing of that object, then unlock the object. In a multi-threaded system, when a thread or process intends to perform some action upon a given object, the thread generally acquires a lock on the object, then begins its operation. In the course of this operation, it may occur that another thread wants to perform some work upon the same object.
An operation can be invoked in this multiple threaded environment which competes against other normal job processing threads for the lock of the object. This can potentially cause deadlock situations in the distributed printing system.
A deadlock situation can occur in a multi-threaded printing environment when a first thread maintains a lock while waiting for a second thread to meet some condition; meanwhile the second thread cannot meet the condition until the first thread unlocks. Processing does not proceed on either thread.
It is an object of this invention to provide a means to avoid deadlock situations between processing threads in a distributed printing system.
This invention provides a document printing system involving multi-threaded processing of a document object. A deadlock situation between a preprocessing thread and a cancellation thread can be averted with a time-out locking mechanism. After the cancellation thread has locked the document object, its sets a cancel flag, then waits for preprocessing to complete. Meanwhile, the preprocessing thread may request a lock of the document object. If so, it will specify a maximum time-out period. After expiration of the time-out period, a timed-out status response will be sent from the document object to the preprocessing thread. The preprocessing thread will then poll the document object for a cancel flag. A cancel flag will be set on the document object only if the cancellation thread has requested the document object perform a cancellation operation. If there is no cancel flag, the preprocessing thread will again request a lock of the document object with a maximum time-out period. If there is a cancel flag, the preprocessing thread will send a cancellation complete signal to the document object.
Other aspects of the invention will become apparent from the following more detailed description, taken in conjunction with the accompanying drawings.